<html>
    <head>
        <link rel="stylesheet" type="text/css" href="<?php echo base_url('public/admin/css/style.css')?>">
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
        <script src="<?php echo base_url('public/admin/js/enable_disable.js')?>"></script>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>List of category</title>
    </head>
<body>
<div id="wraper">
<?php $this->load->view('admin/menu', array('action' => $action)); ?>
    <div id="content">
            <div id="add">
                <center>
                    <form action="" method="POST">
                        <label>Category : </label><input type="text" name="name_category"/>
                        <input type="submit" name="submit" value="Add">
                    </form>
                </center>
            </div>
       <div id="thongbao"><!--- thông báo enable/disable --></div>
        <div class="total_pagination">
             <div id="show_search" class="float_left">
                     <b>Total:</b>
                     About <?php echo "2343" ?> result.
             </div>
             <div id="pagination" class="float_right">
                     <?php echo 'pagination';?>
             </div>
            <div class="clear"></div>
        </div>
        <div class="show_data">
            <table border="0" cellspacing="0" cellpadding="5" width="100%">
                    <tr>
                        <td colspan="4" align='right'>
                            <form method="get" class="status_all" >
                                <span style="color:brown;">Enable or Disable all categories ? </span>
                                <input type="radio" value="1" name="status_all" class="enable_all" name_site="categories"> Enable
                                <input type="radio" value="0" name="status_all" class="disable_all" name_site="categories"> Disable
                            </form>
                        </td>
                    </tr>
                    <tr>
                        <td class="title"> Name</td>
                        <td class="title"> Operation</td>
                        <td class="title"> Status</td>  
                    </tr>
                    <?php foreach ($categories as $item): ?>
                        <tr>
                            <td class="show_name"><?php echo $item["name"]; ?></td>
                            <td class="infor_show">
                                <a href="edit_categories.php?id=<?php echo $item["id"];?>" class="edit">Edit</a>
                            </td>
                            <td>
                                <form method="get" id="<?php echo $item["id"];?>">
                                    <input type="radio" value="1" name="status" class="enable" <?php if($item["status"]==1) echo "checked='checked'"?> onchange="if(this.checked) enable('?id=<?php echo $item['id'];?>&name_site=categories.php&status='+this.value);"> Enable
                                    <input type="radio" value="0" name="status" class="disable" <?php if($item["status"]==0) echo "checked='checked'"?> onchange="if(this.checked) disable('?id=<?php echo $item['id'];?>&name_site=categories.php&status='+this.value);"> Disable
                                </form>
                            </td>
                        </tr>
                    <?php endforeach; ?>
            </table>
        </div><!-- End: #show_data; -->
    </div> <!-- End #content -->
   <?php $this->load->view('admin/footer');?>
</div><!-- End #wraper -->
</body>
</html>
